__author__ = 'ipetrov'
from internal_page import InternalPage
from selenium.webdriver.common.by import By


class MyCollectionPage(InternalPage):

    @property
    def add_movie_button(self):
        return self.driver.find_element_by_css_selector("img[alt=\"Add movie\"]")

    @property
    def search_for_movies_field(self):
        return self.driver.find_element_by_id("q")

    @property
    def is_this_page(self):
        return self.is_element_visible((By.CSS_SELECTOR, "img[alt=\"Add movie\"]"))

    @property
    def current_count_of_movies(self):
        return len(self.driver.find_element_by_id("results").find_elements_by_xpath("./a"))

    @property
    def first_movie_link(self):
        return self.driver.find_element_by_css_selector("div.nocover")

    @property
    def empty_search_string(self):
        return self.driver.find_element_by_class_name("content")